<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
  <div>
    <input type="text" v-model="name"/>
  </div>
  <div>
    <p>name:<span>{{name}}</span></p>
  </div>

  <button id="btn">改变</button>
</div>
<script src="./mvvm.js"></script>
<script>
  /**
   * 数据双向绑定 测试案例
   * @type {MVVM}
   */
  const app = new MVVM("#app",{
    name:''
  });

  const btn = document.querySelector("#btn")
  btn.addEventListener('click',function () {
    app.setData('name','luolinlan')
  })
</script>
<!--<script>
  window.onload = function () {

    const obj = {
      name:"hello",
      age:12,
      job:{
        workname:'IT Manager',
        worksation:'cd'
      }
    };
    function deepClone(data) {

      if(data == undefined || typeof data!=='object'){
        return data
      }

      const result = new data.constructor()
      for(let a in data){
        if(data.hasOwnProperty(a)){
          result[a] = deepClone(data[a])
        }
      }
      return result
    }

    console.log(deepClone(obj))
  }
</script>-->

</body>
</html>
